<template>
	<view class="mainpadding">
		<view class="" style="padding-bottom: 180rpx;">
			<view class="">
				<u-swiper :list="dataAll.images_text" imgMode="widthFix" keyName="image_text" height="140" indicator
					circular></u-swiper>
				<view class="mainpadding ffffff" style="border-radius: 0 0 24rpx 24rpx;">
					<view class="flexbetween xiahuaxian ">
						<view class="titletext xiaohei fonweight">{{dataAll.name}}</view>
						<view class="">
							<text class="xiaohei strongtext">库存：</text>
							<text class="xiaohong strongtext">{{dataAll.sales}}</text>
						</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="">
							<text class="xiaohei strongtext">快递：</text>
							<text class="xiaohui strongtext">免费</text>
						</view>
						<u-number-box button-size="36" color="#000000" bgColor="#F7F7F7" iconStyle="color: #fff"
							v-model="number"></u-number-box>
					</view>
				</view>
			</view>
			<!--  活动详情-->
			<view class="mainpadding_top ffffff" style="border-radius:24rpx;">
				<view class="flexleft">
					<view class="allline margin_right1"></view>
					<view class="sanshier xiaohei fonweight">活动详情</view>
				</view>
				<view class="margin_top">
					<u-parse :content="dataAll.content"></u-parse>
				</view>
			</view>
		</view>
		<view class="gudingdb ffffff mainpadding flexbetween">
			<view class="sanshier xiaohei fonweight">所需青统币:{{number*dataAll.price}}</view>
			<view class="ljbmbtn flexcenter" @click="duihuan()">立即兑换</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid: "",
				dataAll: {},
				number:1,
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.getDetail()
		},
		methods: {
			getDetail() {
				httpRequest.request('/api/goodscl/goodsDetail', 'GET', {
					goods_id: this.listid,
				}).then(res => {
					res.data.content = res.data.content ? res.data.content.replace(/\<img/gi,
						'<img style="display:block" ') : "";
					this.dataAll = res.data
				}).catch(err => {})
			},
			duihuan(){
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login"
					})
					return false
				}
				let data = [{
						goods_id: this.listid,
						number: this.number
					}]
				uni.navigateTo({
					url: '/pages/qingfuli/querendd?msg=' + encodeURIComponent(JSON.stringify(data))
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.ljbmbtn {
		width: 266rpx;
		height: 88rpx;
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
		background: #FF4609;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}
</style>